import Vue from 'vue'
import Router from 'vue-router'
import index from '@/pages/index/index.vue'
import category from '@/pages/category/category.vue'
import categorys from '@/pages/category/category-s.vue'
import brands from '@/pages/category/brands.vue'
import area from '@/pages/category/area.vue'
import user from '@/pages/user/user.vue'
import setting from '@/pages/setting/index.vue'
import userinfo from '@/pages/setting/userinfo.vue'
import cart from '@/pages/cart/cart.vue'
import pay from '@/pages/pay/pay.vue'
import logistics from '@/pages/logistics/logistics.vue'
import address from '@/pages/address/address.vue'
import addressEdit from '@/pages/address/addressEdit.vue'
import addressNew from '@/pages/address/addressNew.vue'
import order from '@/pages/order/order.vue'
import orderList from '@/pages/order/order-list.vue'
import orderDetail from '@/pages/order/order-detail.vue'
import search from '@/pages/search/search.vue'
import searchList from '@/pages/search/searchList.vue'
import desk from '@/pages/desk/desk.vue'
import item from '@/pages/item/item.vue'
import comment from '@/pages/item/comment.vue'
import login from '@/pages/login/login.vue'
import register from '@/pages/register/register.vue'
import forget from '@/pages/forget/forget.vue'
import password from '@/pages/setting/password.vue'
import App from '../App'

Vue.use(Router)
export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'App',
      component: App,
      children: [ // 二级路由。对应App.vue
        // 地址为空时跳转home页面
        {
          path: '',
          redirect: '/index'
        }, {
          path: '/index',
          name: 'index',
          component: index
        }, {
          path: '/category',
          name: 'category',
          component: category,
          children: [ // 二级路由。对应App.vue
            // 地址为空时跳转home页面
            {
              path: '/category',
              component: categorys
            }, {
              path: '/category/area',
              component: area
            }, {
              path: '/category/brands',
              component: brands
            }
          ]
        }, {
          path: '/user',
          name: 'user',
          component: user
        }, {
          path: '/userinfo',
          name: 'userinfo',
          component: userinfo
        }, {
          path: '/setting',
          name: 'setting',
          component: setting
        }, {
          path: '/cart',
          name: 'cart',
          component: cart
        }, {
          path: '/pay',
          name: 'pay',
          component: pay
        }, {
          path: '/logistics',
          name: 'logistics',
          component: logistics
        }, {
          path: '/address',
          name: 'address',
          component: address
        }, {
          path: '/addressEdit',
          name: 'addressEdit',
          component: addressEdit
        }, {
          path: '/addressNew',
          name: 'addressNew',
          component: addressNew
        }, {
          path: '/order',
          name: 'order',
          component: order
        }, {
          path: '/orderList',
          name: 'orderList',
          component: orderList
        }, {
          path: '/orderDetail',
          name: 'orderDetail',
          component: orderDetail
        },
        {
          path: '/search',
          name: 'search',
          component: search
        }, {
          path: '/searchList',
          name: 'searchList',
          component: searchList
        }, {
          path: '/desk',
          name: 'desk',
          component: desk
        }, {
          path: '/item',
          name: 'item',
          component: item
        }, {
          path: '/comment',
          name: 'comment',
          component: comment
        }, {
          path: '/login',
          name: 'login',
          component: login
        }, {
          path: '/register',
          name: 'register',
          component: register
        }, {
          path: '/forget',
          name: 'forget',
          component: forget
        }, {
          path: '/password',
          name: 'password',
          component: password
        }
      ]
    }
  ]
})


